#pragma comment(linker, "/STACK:10000000")
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <iomanip>
#include <set>
#include <map>
#include <cstdio>
#include <cassert>
#include <string>
#include <cstring>
#define ldb long double
#define LL long long
#define fi first
#define se second
#define fill(a, c) memset(a, c, sizeof(a))
#define sqr(a) ((a) * (a))
#define nextLine() {int c = 0; while((c = getchar()) != 10 && c != EOF);}
#define getBit(mask, k) (((mask) / pw[k]) % pw[1])
#define setBit(mask, k, l) (((mask) / pw[k + 1] * pw[1] + (l)) * pw[k] + ((mask) % pw[k]))
#define debug(a) cerr << #a << " = " << a << " ";
#define debugl(a) cerr << #a << " = " << a << "\n";
const ldb LDINF = 9128739847123.00;
const ldb eps = 1e-9;
const int INF = 1 << 30;
const ldb pi = fabsl(atan2(0.0, -1.0));
using namespace std;


int n;

void Load()
{
	cin >> n;
}
#define isprime(n) ( (d[(n - 1) / 32] & (1 << ((n - 1) & 31))) == 0)
int d[1000000];
int dp[10000];

int f(int n)
{
	if (n == 1) return 0;
	if (dp[n] != -1) return dp[n];
	bool used[10000];
	memset(used, 0, sizeof used);
	for (int i = 1; i < n; i++)
	{
		if (isprime(i))
		{
			used[f(n - i)] = 1;
		}

	}
	for (int i = 0; i < 10000; i++)
	{
		if (used[i] == 0)
		{
			dp[n] = i;
			break;
		}
	}
	return dp[n];
}


void Solve()
{
	if (n % 4 != 1)
		cout << "BOB\n";
	else cout << "ALICE\n";
}



#define file "numgame"
int main()
{
	#ifndef ONLINE_JUDGE
	freopen(file".in", "rt", stdin);
	freopen(file".out", "wt", stdout);
	#endif
	memset(dp, -1, sizeof dp);
	for (int i = 2; i <= 10000; i++)
	{
		if (isprime(i))
		{
			//cerr << i << "\n";
			for (int j = i * i; j <= 10000; j += i)
				d[(j - 1) / 32] |= 1 << ((j - 1) & 31);
		}
	}
	int T;
	cin >> T;
	for (int i = 0; i < T; i++)
	{
		Load();
		Solve();
	}
	return 0;
}
